﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using log4net;
using FJASPX.Service;
using NHibernate.Criterion;
using FJASPX.Framwork.UI;

namespace PlugNT.Cms.Web
{
    public partial class Promotions : HomePageBase
    {
        private static readonly ILog logger = LogManager.GetLogger(typeof(Promotions));

        public IProductService iProductService { get; set; }

        public IProductClassService iProductClassService { get; set; }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(Request.QueryString["ClassId"]))
            {
                Response.Redirect("Error.aspx");
            }
        }
        /// <summary>
        /// 热销版
        /// </summary>
        /// <returns></returns>
        public IList<FJASPX.Domain.Product> GetHotProduct()
        {
            int PageSize = 10;
            long totalCount = 0;
            ICriterion criterion = null;
            List<Order> orders = new List<Order>();
            orders.Add(new Order("TimeStamp", false));
            return iProductService.PagedQuery(criterion, orders, 0, PageSize, out totalCount);
        }
        /// <summary>
        /// 推荐
        /// </summary>
        /// <returns></returns>
        public IList<FJASPX.Domain.Product> GetCommendProduct()
        {
            int PageSize = 12;
            long totalCount = 0;
            ICriterion criterion = null;
            List<Order> orders = new List<Order>();
            orders.Add(new Order("TimeStamp", false));
            return iProductService.PagedQuery(criterion, orders, 0, PageSize, out totalCount);
        }
    }
}